package com.softmaker.controller;

import com.softmaker.service.OpenAIService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/openai")
public class OpenAiController {
    @Autowired
    private OpenAIService openAIService;

    @PostMapping("/call-openai")
    public String callOpenAI(@RequestBody String prompt) {
        System.out.println(prompt);return openAIService.callOpenAI(prompt);
    }
}
